const controller = require('../controller');
const path = require('path');
const Load = require('../utils/_load');


module.exports = (express, app) => {
  const router = express.Router();
  const _app = {
    router,
    controller
  };
  const Routers = Load.loadFileSync(
    path.resolve(__dirname, '../router/'),
    Load.origin,
    [__filename]
  );
  // 通用路由注册
  Object.keys(Routers).forEach(_router => Routers[_router](_app));

  app.use('/', router);
};